package com.bw.realtime_common.function;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.serializer.SerializeConfig;
import org.apache.flink.api.common.functions.MapFunction;

/**
 * @BelongsProject: gmall_lx
 * @BelongsPackage: com.bw.realtime_common.function
 * @Author: cuizexuan
 * @CreateTime: 2025-06-23  22:12
 * @Description: TODO
 * @Version: 1.0
 */
public class DorisMapFunction<T> implements MapFunction<T,String> {
    @Override
    public String map(T t) throws Exception {
        SerializeConfig config = new SerializeConfig();
        config.setPropertyNamingStrategy(PropertyNamingStrategy.SnakeCase);
        return JSONObject.toJSONString(t,config);
    }
}
